<tagLib name="fanwe" />
<include file="Public:header" />
<script type="text/javascript" src="__TMPL__Static/Js/dataList.js"></script>
<script type="text/javascript" src="__TMPL__Static/Js/shareList.js"></script>
<div class="handle-btns">
	<fanwe:imageBtn id="editShare" name="editShare" value="{$Think.lang.EDIT}" click="editData(this,'checkList','share_id')" />
	<fanwe:imageBtn id="removeShare" name="removeShare" value="{$Think.lang.REMOVE}" click="removeData(this,'checkList')" />
	<fanwe:imageBtn id="ShiftClass" name="ShiftClass" value="{$Think.lang.SHIFT_CLASS}" click="ShiftClassData(this,'checkList')" />
	<fanwe:imageBtn id="BatchDelete" name="BatchDelete" value="{$Think.lang.BATCH_DELETE}" click="BatchDelete()" />
</div>
<div class="search-box">
    <form action="__APP__">
		<span>{$Think.lang.SHARE_CONTENT}</span>
		<input class="textinput" type="text" value="{$keyword}" name="keyword" size="12" />
		<small></small>
		<span>{$Think.lang.USER_NAME}</span>
		<input class="textinput" type="text" value="{$uname}" name="uname" id="user_name" size="8" />
		<small></small>
		<span>{$Think.lang.SHARE_DATA}</span>
		<select name="share_data">
			<option value="goods_photo">{$Think.lang.SHARE_DATA_GOODS_PHOTO}</option>
			<option value="goods" <if condition="$share_data eq 'goods'">selected="selected"</if> >{$Think.lang.SHARE_DATA_GOODS}</option>
			<option value="photo" <if condition="$share_data eq 'photo'">selected="selected"</if> >{$Think.lang.SHARE_DATA_PHOTO}</option>
		</select>
		<small></small>
		<span>{$Think.lang.SHARE_CATEGORY}</span>
		<select name="cate_id">
			<option value="0" <if condition="$cate_id eq 0">selected="selected"</if> >{$Think.lang.SHARE_ALL}</option>
			<option value="-1" <if condition="$cate_id eq -1">selected="selected"</if> >{$Think.lang.NO_CATEGORY}</option>
			<foreach name="cate_list" item="cate_item">
			<option value="{$cate_item.cate_id}" <if condition="$cate_id eq $cate_item['cate_id']">selected="selected"</if> >{$cate_item.cate_name}</option>
			</foreach>
		</select>
		<input class="submit_btn" type="submit" value="{$Think.lang.SEARCH}" />
		<input type="hidden" name="{:c('VAR_MODULE')}" value="{$module_name}" />
		<input type="hidden" name="{:c('VAR_ACTION')}" value="image" />
	</form>
</div>
<table id="checkList" class="table-list list" cellpadding="0" cellspacing="0" border="0">
    <thead>
        <tr>
            <th width="26" class="first"><input type="checkbox" onclick="checkAll('checkList')"></th>
            <th width="80"><a href="javascript:sortBy('share_id','','check')">{$Think.lang.ID}</a></th>
            <th>{$Think.lang.SHARE_CATEGORY}</th>
			<th>{$Think.lang.USER_NAME}</th>
			<th>{$Think.lang.COLOR}</th>
            <th width="130">{$Think.lang.CREATE_TIME}</th>
			<th width="60">{$Think.lang.COLLECT_COUNT}</th>
            <th width="60">{$Think.lang.RELAY_COUNT}</th>
			<th>{$Think.lang.COMMENT_COUNT}</th>
            <th width="70">{$Think.lang.SHARE_TYPE}</th>
            <th width="70">{$Think.lang.SHARE_DATA}</th>
            <th width="40">{$Think.lang.STATUS}</th>
            <th width="80">{$Think.lang.HANDLE}</th>
        </tr>
    </thead>
	<?php
		$index = -1;
	?>
    <tbody>
		<foreach name="list" item="item">
		<?php
			$index++;
			$row_count = ' rowspan="3"';
			if($index % 2 == 0)
				$tr_class = ' class="tr'.$item['share_id'].'"';
			else
				$tr_class = ' class="tr'.$item['share_id'].' even"';
			
			$item['tags'] = '';
			if(isset($item['cache_data']['tags']) && isset($item['cache_data']['tags']['user']))
			{
				$item['tags'] = array();
				foreach($item['cache_data']['tags']['user'] as $tag)
				{
					$item['tags'][] = $tag['tag_name'];
				}
				$item['tags'] = implode("，",$item['tags']);
			}
		?>
        <tr{$tr_class}>
            <td class="first"{$row_count}><input type="checkbox" name="key" value="{$item.share_id}"></td>
            <td {$row_count}>{$item.share_id}</td>
            <td>{$item.cate_name}</td>
            <td>{$item.user_name}</td>
			<td>{$item.color_name}</td>
            <td>{:toDate($item['create_time'])}</td>
			<td>{$item.relay_count}</td>
			<td>{$item.collect_count}</td>
			<td>{:getCommentCount($item['comment_count'],$item['share_id'])}</td>
			<td>{:getTypeName($item['type'])}</td>
			<td>{:getShareData($item['share_data'])}</td>
			<td><span class="pointer" module="Share" href="javascript:;" onclick="toggleStatus(this,'{$item.share_id}','status')">{:getStatusImg($item['status'])}</span></td>
			<td{$row_count}>
				<a href="javascript:;" onclick="editData(this,'{$item.share_id}','share_id')">{$Think.lang.EDIT}</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" onclick="removeData(this,'{$item.share_id}','share_id')">{$Think.lang.REMOVE}</a><br/><br/>
				{:getHandlerLink($item['is_index'],$item)}
			</td>
        </tr>
		<tr{$tr_class} align="left">
			<td colspan="4" class="torder">
				<foreach name="item['cache_data']['imgs']['all']" item="img">
				<a href="{:adminFormatImgById($img['img_id'])}" target="_blank"><img class="imgTooltip" title="<img src='{:adminFormatImgById($img['img_id'])}' height='200' />" src="{:adminFormatImgById($img['img_id'],100,100)}" height="30" style="border:solid 1px #ccc;" /></a>
				</foreach>
			</td>
			<td colspan="6" class="torder">{$Think.lang.SHARE_TAGS}：{$item.tags}</td>
		</tr>
		<tr{$tr_class} align="left">
			<td colspan="10" class="torder">
				{$Think.lang.SHARE_CONTENT}：{$item.content}
			</td>
		</tr>
		</foreach>
    </tbody>
</table>
<div class="pager">{$page}</div>
<script type="text/javascript">
FANWE.IS_TOGGLE_FUNC = function(query){
	if(query.field == 'is_index')
	{
		if(query.val == 0)
		{
			var url = APP + '?' + VAR_MODULE + '=IndexCateShare&' + VAR_ACTION + '=add&share_id='+query.id;
			$("#is_index_"+query.id).html('<a href="'+url+'">{$Think.lang.IS_INDEX_0}</a>');
		}
	}
};
</script>
<include file="Public:footer" />